package com.taotao.observer.controller;

import com.taotao.observer.entity.MsgEntity;
import com.taotao.observer1.impl.MsgSubject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wangjin
 * @CreateTime: 2022-07-02  22:10
 */
@RestController
@Slf4j
public class ObserverController {
    @Autowired
    private ApplicationContext applicationContext;
        @Autowired
        private MsgSubject msgSubject;
    @RequestMapping("/register")
    public String register(){
          log.info("register。。。。。。");
        // 发送短信、发送邮件、发送微信公众号
        // sendMsg();
        // sendEmail();
        // sendWechatTemplate();
     /*   MsgEntity msgEntity=new MsgEntity(this,"18547554252","552@qq.com","ws777","sdss5470");
        applicationContext.publishEvent(msgEntity);*/
        msgSubject.notifyAll("ww333");

        return "ok";
    }

}
